@DTS Engineer unfortunately yes. I reproduced with Xcode 26 beta 6 (17A5305f) and an iPad running iOS 26 beta 7 (23A5326a).
The following code will produce the runtime exception.
slider.addTarget(
self,
action: #selector(sliderValueDidChange(_:for:)),
for: .valueChanged
)
// ...
@objc
func sliderValueDidChange(_ sender: UISlider, for event: UIEvent) {
print(event)
}
whereas changing the event parameter type to UIControl.Event doesn't produce it:
@objc
func sliderValueDidChange(_ sender: UISlider, for event: UIControl.Event) {
print(event)
}
Do note that changing the action method body to
@objc
func sliderValueDidChange(_ sender: UISlider, for event: UIEvent) {
print("Event: \(event)")
}
has always been working fine, but that is because the String interpolation treats the event value as nil I believe (by printing an empty String).
Topic:
UI Frameworks
SubTopic:
UIKit
Tags: